library(plyr)
library(psych)
library(ggplot2)
library(Hmisc)
library(stats)
library(lm.beta)
library(lmtest)
library(ggpubr)
library(dotwhisker)
library(boot)
library(knitr)
library(kableExtra)
library(ggdag)
library(mosaic)
library(mets)
library(stargazer)
#devtools::install_github("malcolmbarrett/ggdag")
#devtools::install_github("kkholst/lava")
#devtools::install_github("kkholst/mets")
## Mode FALSE TRUE
## logical 510 117
The missing check is OK. Lines up with imaging data.
Nice function to make a pretty table
tablr<-function(Y,x,D){
Q<-favstats(Y ~ x, data = D)
Q.stat <- Q[, c("x", "n", "mean", "sd")]
colnames(Q.stat)<-c("test","n", "mean", "sd")
a<-match.call()[2]
return(Q.stat)
}
demo_vars<-c("Race","BMI","HbA1C","Menstrual_AgeBegan","Age_in_Yrs","group")
dems<-d4[demo_vars]
byRace<-apply(dems, MARGIN = 2, FUN = tablr, x=dems$Race, D=dems)
byGroup<-apply(dems, MARGIN = 2, FUN = tablr, x=dems$group, D=dems)
t1<-merge(byRace$BMI,byRace$HbA1C,by="test")
t2<-merge(t1,byRace$Menstrual_AgeBegan,by="test")
t3<-merge(t2, byRace$Age_in_Yrs, by="test")
s1<-merge(byGroup$BMI,byGroup$HbA1C,by="test")
s2<-merge(s1,byGroup$Menstrual_AgeBegan,by="test")
s3<-merge(s2, byGroup$Age_in_Yrs, by="test")
all<-rbind(t3,s3)
row.names(all)<-all$test
row.names(all)<-c("Native American", "Asian, Native Hawaiian, or Pacific Islander","Black or African American","More than one race","Unknown or chose not to report","White","Total")
drops <- c("test")
all<-all[ , !(names(all) %in% drops)]
kable(all, format = "html", col.names = c("n","mean","SD",
"n","mean","SD",
"n","mean","SD",
"n","mean","SD"),
caption = "Table 1: Descriptive statistics by reported race",
digits = c(0, 3, 3, 0, 3, 3,0, 3, 3,0, 3, 3), align = "ccrr") %>%
kable_styling(full_width = FALSE, position = "left") %>%
add_header_above(c(" " = 1,"BMI"= 3,"HbA1C"= 3,"Age of menses onset"=3,"Age at scan"=3))
| n | mean | SD | n | mean | SD | n | mean | SD | n | mean | SD | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Native American | 1 | 29.230 | NA | 1 | 5.900 | NA | 1 | 16.000 | NA | 1 | 35.000 | NA |
| Asian, Native Hawaiian, or Pacific Islander | 36 | 21.793 | 3.790 | 24 | 5.213 | 0.310 | 36 | 12.306 | 1.508 | 36 | 27.278 | 4.340 |
| Black or African American | 111 | 29.868 | 7.080 | 56 | 5.405 | 0.334 | 111 | 12.315 | 1.768 | 111 | 29.676 | 3.565 |
| More than one race | 17 | 27.582 | 6.311 | 11 | 5.345 | 0.238 | 17 | 12.529 | 1.663 | 17 | 27.000 | 4.093 |
| Unknown or chose not to report | 13 | 29.071 | 6.968 | 9 | 5.267 | 0.381 | 13 | 12.462 | 1.613 | 13 | 27.923 | 3.730 |
| White | 449 | 26.243 | 6.006 | 291 | 5.187 | 0.374 | 449 | 12.811 | 1.484 | 449 | 29.935 | 3.374 |
| Total | 627 | 26.729 | 6.390 | 392 | 5.228 | 0.370 | 627 | 12.684 | 1.561 | 627 | 29.624 | 3.579 |
Earlier onset of puberty significantly related to heavier adult BMI.
ggplot(d4, aes(Menstrual_AgeBegan, BMI)) +
geom_point(shape=1) +
geom_smooth(method=lm,colour='black')+theme_classic()+scale_y_continuous(name="Body Mass Index (BMI)")+
scale_x_continuous(name="Age of onset of menstration")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
m1<-lm( BMI ~ Menstrual_AgeBegan, data=d4)
summary(m1)
##
## Call:
## lm(formula = BMI ~ Menstrual_AgeBegan, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.268 -4.510 -1.588 3.470 28.502
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 36.9131 2.0519 17.990 < 2e-16 ***
## Menstrual_AgeBegan -0.8029 0.1606 -5.001 7.43e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.271 on 625 degrees of freedom
## Multiple R-squared: 0.03847, Adjusted R-squared: 0.03693
## F-statistic: 25.01 on 1 and 625 DF, p-value: 7.429e-07
m2<-lm( BMI ~ Menstrual_AgeBegan+Age_in_Yrs, data=d4)
lrtest(m1,m2)
## Likelihood ratio test
##
## Model 1: BMI ~ Menstrual_AgeBegan
## Model 2: BMI ~ Menstrual_AgeBegan + Age_in_Yrs
## #Df LogLik Df Chisq Pr(>Chisq)
## 1 3 -2039.8
## 2 4 -2035.1 1 9.4837 0.002073 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(m2)
##
## Call:
## lm(formula = BMI ~ Menstrual_AgeBegan + Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -11.006 -4.531 -1.413 3.288 27.550
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 30.79074 2.84517 10.822 < 2e-16 ***
## Menstrual_AgeBegan -0.82155 0.15959 -5.148 3.54e-07 ***
## Age_in_Yrs 0.21465 0.06961 3.084 0.00213 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.229 on 624 degrees of freedom
## Multiple R-squared: 0.05291, Adjusted R-squared: 0.04987
## F-statistic: 17.43 on 2 and 624 DF, p-value: 4.311e-08
m3<-lm( BMI ~ Menstrual_AgeBegan+Age_in_Yrs+Race, data=d4)
lrtest(m2,m3)
## Likelihood ratio test
##
## Model 1: BMI ~ Menstrual_AgeBegan + Age_in_Yrs
## Model 2: BMI ~ Menstrual_AgeBegan + Age_in_Yrs + Race
## #Df LogLik Df Chisq Pr(>Chisq)
## 1 4 -2035.1
## 2 9 -2009.1 5 51.999 5.397e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(m3)
##
## Call:
## lm(formula = BMI ~ Menstrual_AgeBegan + Age_in_Yrs + Race, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -10.408 -4.320 -1.238 2.882 28.182
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 35.27084 6.91457 5.101
## Menstrual_AgeBegan -0.77064 0.15566 -4.951
## Age_in_Yrs 0.17970 0.06886 2.610
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. -8.89609 6.13191 -1.451
## RaceBlack or African Am. -1.24487 6.06447 -0.205
## RaceMore than one -2.88523 6.22093 -0.464
## RaceUnknown or Not Reported -1.61441 6.26882 -0.258
## RaceWhite -4.53487 6.03652 -0.751
## Pr(>|t|)
## (Intercept) 4.50e-07 ***
## Menstrual_AgeBegan 9.55e-07 ***
## Age_in_Yrs 0.00928 **
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.14735
## RaceBlack or African Am. 0.83743
## RaceMore than one 0.64296
## RaceUnknown or Not Reported 0.79686
## RaceWhite 0.45279
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6 on 619 degrees of freedom
## Multiple R-squared: 0.1283, Adjusted R-squared: 0.1184
## F-statistic: 13.01 on 7 and 619 DF, p-value: 1.126e-15
lm.beta(m3)
##
## Call:
## lm(formula = BMI ~ Menstrual_AgeBegan + Age_in_Yrs + Race, data = d4)
##
## Standardized Coefficients::
## (Intercept)
## 0.00000000
## Menstrual_AgeBegan
## -0.18826215
## Age_in_Yrs
## 0.10065023
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.
## -0.32413032
## RaceBlack or African Am.
## -0.07441944
## RaceMore than one
## -0.07339148
## RaceUnknown or Not Reported
## -0.03602837
## RaceWhite
## -0.32023817
Age of menstration is significantly related to adult BMI. This relationship remains significant with the addition of age and race in the model. Both age and race improve the model fit.
img<-read.table("~/Google Drive/HCP_graph/1200/5000perms/p_corrected.csv", sep=",", header=F)
row.names(img)<-c("<BMI",">BMI","<AoM",">AoM","<AoMxBMI",">AoMxBMI")
# head(img)
img_p<-1-img
# head(img_p)
bool<-img_p<0.05
img_p[img_p > 0.05] <- NA
5->7 == V67 5->10 == V70 9->11 == V131 10->13 == V148 14->12 == V207
matrix( as.matrix(img_p[1,1:225]),nrow=15, ncol=15)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
## [1,] NA NA NA NA NA NA NA NA NA NA NA NA
## [2,] NA NA NA NA NA NA NA NA NA NA NA NA
## [3,] NA NA NA NA NA NA NA NA NA NA NA NA
## [4,] NA NA NA NA NA NA NA NA NA NA NA NA
## [5,] NA NA NA NA NA NA 0.003 NA NA 0.012 NA NA
## [6,] NA NA NA NA NA NA NA NA NA NA NA NA
## [7,] NA NA NA NA 0.003 NA NA NA NA NA NA NA
## [8,] NA NA NA NA NA NA NA NA NA NA NA NA
## [9,] NA NA NA NA NA NA NA NA NA NA 0.003 NA
## [10,] NA NA NA NA 0.012 NA NA NA NA NA NA NA
## [11,] NA NA NA NA NA NA NA NA 0.003 NA NA NA
## [12,] NA NA NA NA NA NA NA NA NA NA NA NA
## [13,] NA NA NA NA NA NA NA NA NA 0.002 NA NA
## [14,] NA NA NA NA NA NA NA NA NA NA NA 0.037
## [15,] NA NA NA NA NA NA NA NA NA NA NA NA
## [,13] [,14] [,15]
## [1,] NA NA NA
## [2,] NA NA NA
## [3,] NA NA NA
## [4,] NA NA NA
## [5,] NA NA NA
## [6,] NA NA NA
## [7,] NA NA NA
## [8,] NA NA NA
## [9,] NA NA NA
## [10,] 0.002 NA NA
## [11,] NA NA NA
## [12,] NA 0.037 NA
## [13,] NA NA NA
## [14,] NA NA NA
## [15,] NA NA NA
p1<-ggplot(d4, aes(BMI, V67)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="5 and 7")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
p2<-ggplot(d4, aes(BMI, V70)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="5 and 10")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
p3<-ggplot(d4, aes(BMI, V131)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="9 and 11")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
p4<-ggplot(d4, aes(BMI, V148)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="10 and 13")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
ggarrange(p1,p2,p3,p4 + rremove("x.text"),
labels = c("A", "B", "C","D"),
ncol = 2, nrow = 2)
## Warning: Removed 117 rows containing non-finite values (stat_smooth).
## Warning: Removed 117 rows containing missing values (geom_point).
## Warning: Removed 117 rows containing non-finite values (stat_smooth).
## Warning: Removed 117 rows containing missing values (geom_point).
## Warning: Removed 117 rows containing non-finite values (stat_smooth).
## Warning: Removed 117 rows containing missing values (geom_point).
## Warning: Removed 117 rows containing non-finite values (stat_smooth).
## Warning: Removed 117 rows containing missing values (geom_point).
1->6 == V6 3->4 == V34 4->8 == V53 4->15 == V60 10->12 == V147 10->15 == V150
matrix( as.matrix(img_p[2,1:225]),nrow=15, ncol=15)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
## [1,] NA NA NA NA NA 0.044 NA NA NA NA NA NA
## [2,] NA NA NA NA NA NA NA NA NA NA NA NA
## [3,] NA NA NA 0.046 NA NA NA NA NA NA NA NA
## [4,] NA NA 0.046 NA NA NA NA 0.016 NA NA NA NA
## [5,] NA NA NA NA NA NA NA NA NA NA NA NA
## [6,] 0.044 NA NA NA NA NA NA NA NA NA NA NA
## [7,] NA NA NA NA NA NA NA NA NA NA NA NA
## [8,] NA NA NA 0.016 NA NA NA NA NA NA NA NA
## [9,] NA NA NA NA NA NA NA NA NA NA NA NA
## [10,] NA NA NA NA NA NA NA NA NA NA NA 0.006
## [11,] NA NA NA NA NA NA NA NA NA NA NA NA
## [12,] NA NA NA NA NA NA NA NA NA 0.006 NA NA
## [13,] NA NA NA NA NA NA NA NA NA NA NA NA
## [14,] NA NA NA NA NA NA NA NA NA NA NA NA
## [15,] NA NA NA 0.002 NA NA NA NA NA 0.014 NA NA
## [,13] [,14] [,15]
## [1,] NA NA NA
## [2,] NA NA NA
## [3,] NA NA NA
## [4,] NA NA 0.002
## [5,] NA NA NA
## [6,] NA NA NA
## [7,] NA NA NA
## [8,] NA NA NA
## [9,] NA NA NA
## [10,] NA NA 0.014
## [11,] NA NA NA
## [12,] NA NA NA
## [13,] NA NA NA
## [14,] NA NA NA
## [15,] NA NA NA
p1<-ggplot(d4, aes(BMI, V6)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="1 and 6")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
p2<-ggplot(d4, aes(BMI, V34)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="3 and 4")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
p3<-ggplot(d4, aes(BMI, V53)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="4 and 8")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
p4<-ggplot(d4, aes(BMI, V60)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="4 and 15")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
ggarrange(p1,p2,p3,p4 + rremove("x.text"),
labels = c("A", "B", "C","D"),
ncol = 2, nrow = 2)
## Warning: Removed 117 rows containing non-finite values (stat_smooth).
## Warning: Removed 117 rows containing missing values (geom_point).
## Warning: Removed 117 rows containing non-finite values (stat_smooth).
## Warning: Removed 117 rows containing missing values (geom_point).
## Warning: Removed 117 rows containing non-finite values (stat_smooth).
## Warning: Removed 117 rows containing missing values (geom_point).
## Warning: Removed 117 rows containing non-finite values (stat_smooth).
## Warning: Removed 117 rows containing missing values (geom_point).
12->15 == V180
matrix( as.matrix(img_p[3,1:225]),nrow=15, ncol=15)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
## [1,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [2,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [3,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [4,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [5,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [6,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [7,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [8,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [9,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [10,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [11,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [12,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [13,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [14,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [15,] NA NA NA NA NA NA NA NA NA NA NA 0.048 NA
## [,14] [,15]
## [1,] NA NA
## [2,] NA NA
## [3,] NA NA
## [4,] NA NA
## [5,] NA NA
## [6,] NA NA
## [7,] NA NA
## [8,] NA NA
## [9,] NA NA
## [10,] NA NA
## [11,] NA NA
## [12,] NA 0.048
## [13,] NA NA
## [14,] NA NA
## [15,] NA NA
p1<-ggplot(d4, aes(Menstrual_AgeBegan, V180)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="12 and 15")+
scale_x_continuous(name="AoM")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
p1
## Warning: Removed 117 rows containing non-finite values (stat_smooth).
## Warning: Removed 117 rows containing missing values (geom_point).
none
matrix( as.matrix(img_p[4,1:225]),nrow=15, ncol=15)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
## [1,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [2,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [3,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [4,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [5,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [6,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [7,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [8,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [9,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [10,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [11,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [12,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [13,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [14,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [15,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [,14] [,15]
## [1,] NA NA
## [2,] NA NA
## [3,] NA NA
## [4,] NA NA
## [5,] NA NA
## [6,] NA NA
## [7,] NA NA
## [8,] NA NA
## [9,] NA NA
## [10,] NA NA
## [11,] NA NA
## [12,] NA NA
## [13,] NA NA
## [14,] NA NA
## [15,] NA NA
So we can visualize the interaction effect
describe(d4$Menstrual_AgeBegan)
## d4$Menstrual_AgeBegan
## n missing distinct Info Mean Gmd .05 .10
## 627 0 11 0.946 12.68 1.67 10 11
## .25 .50 .75 .90 .95
## 12 13 13 15 15
##
## Value 8 9 10 11 12 13 14 15 16 17
## Frequency 2 16 23 67 186 182 82 39 19 7
## Proportion 0.003 0.026 0.037 0.107 0.297 0.290 0.131 0.062 0.030 0.011
##
## Value 18
## Frequency 4
## Proportion 0.006
hist(d4$Menstrual_AgeBegan)
quantile(d4$Menstrual_AgeBegan, prob = c(0.33, 0.66))
## 33% 66%
## 12 13
d4$AoM[d4$Menstrual_AgeBegan<12]<-"early"
d4$AoM[d4$Menstrual_AgeBegan>13]<-"late"
summary(as.factor(d4$AoM))
## early late NA's
## 108 151 368
matrix( as.matrix(img_p[5,1:225]),nrow=15, ncol=15)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
## [1,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [2,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [3,] NA NA NA NA NA 0 NA NA NA NA NA NA NA
## [4,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [5,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [6,] NA NA 0 NA NA NA NA NA NA NA NA NA NA
## [7,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [8,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [9,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [10,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [11,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [12,] NA NA NA NA NA NA NA NA NA NA NA NA 0.026
## [13,] NA NA NA NA NA NA NA NA NA NA NA 0.026 NA
## [14,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [15,] NA NA NA NA NA NA NA NA NA NA NA NA NA
## [,14] [,15]
## [1,] NA NA
## [2,] NA NA
## [3,] NA NA
## [4,] NA NA
## [5,] NA NA
## [6,] NA NA
## [7,] NA NA
## [8,] NA NA
## [9,] NA NA
## [10,] NA NA
## [11,] NA NA
## [12,] NA NA
## [13,] NA NA
## [14,] NA NA
## [15,] NA NA
p1<-ggplot(subset(d4, !is.na(d4$AoM)), aes(BMI, V36, group=AoM, color=AoM)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="3 and 6")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
p2<-ggplot(subset(d4, !is.na(d4$AoM)), aes(BMI, V178, group=AoM,color=AoM)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="12 and 13")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
ggarrange(p1,p2 ,
labels = c("A", "B"),
ncol = 2, nrow = 1)
## Warning: Removed 47 rows containing non-finite values (stat_smooth).
## Warning: Removed 47 rows containing missing values (geom_point).
## Warning: Removed 47 rows containing non-finite values (stat_smooth).
## Warning: Removed 47 rows containing missing values (geom_point).
2 (DMN) ->3 (visual) == V18 ### IC 2
matrix( as.matrix(img_p[6,1:225]),nrow=15, ncol=15)
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
## [1,] NA NA NA NA NA NA NA NA NA NA NA NA
## [2,] NA NA 0.004 NA NA NA NA NA NA NA NA NA
## [3,] NA 0.004 NA NA NA NA NA NA NA NA NA NA
## [4,] NA NA NA NA NA NA NA NA NA NA NA NA
## [5,] NA NA NA NA NA NA NA NA NA NA NA NA
## [6,] NA NA NA NA NA NA NA NA NA NA NA NA
## [7,] NA NA NA NA NA NA NA NA NA NA NA NA
## [8,] NA NA NA NA NA NA NA NA NA NA NA NA
## [9,] NA NA NA NA NA NA NA NA NA NA NA NA
## [10,] NA NA NA NA NA NA NA NA NA NA NA NA
## [11,] NA NA NA NA NA NA NA NA NA NA NA NA
## [12,] NA NA NA NA NA NA NA NA NA NA NA NA
## [13,] NA NA NA NA NA NA NA NA NA NA NA NA
## [14,] NA NA NA NA NA NA NA NA NA NA NA NA
## [15,] NA NA NA NA NA NA NA NA NA NA NA NA
## [,13] [,14] [,15]
## [1,] NA NA NA
## [2,] NA NA NA
## [3,] NA NA NA
## [4,] NA NA NA
## [5,] NA NA NA
## [6,] NA NA NA
## [7,] NA NA NA
## [8,] NA NA NA
## [9,] NA NA NA
## [10,] NA NA NA
## [11,] NA NA NA
## [12,] NA NA NA
## [13,] NA NA NA
## [14,] NA NA NA
## [15,] NA NA NA
p1<-ggplot(subset(d4, !is.na(d4$AoM)), aes(BMI, V18, group=AoM, color=AoM)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="2 and 3")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
p1
## Warning: Removed 47 rows containing non-finite values (stat_smooth).
## Warning: Removed 47 rows containing missing values (geom_point).
summary(as.factor(d4$Menstrual_UsingBirthControl))
## 0 1
## 452 175
# yes = 1
onBC<-subset(d4, d4$Menstrual_UsingBirthControl == "1")
summary(as.factor(onBC$Menstrual_UsingBirthControl))
## 1
## 175
summary(as.factor(onBC$Menstrual_BirthControlCode))
## 1 2 3 4 6 NA's
## 118 34 1 8 13 1
# 1=OC's for contraception, 2=OC's primarily for menstrual regulation, 3=estradiol for menstrual regulation, 4=progesterone for menstrual regulation, 5=fertility therapy, 6=other, 7=unknown (Asked of female participants only)
# SSAGA_Employ SSAGA_Income SSAGA_Educ SSAGA_InSchool SSAGA_Rlshp
## not working = 0, part-time employment = 1; full-time employment = 2
summary(as.factor(d4$SSAGA_Employ))
## 0 1 2 NA's
## 117 118 391 1
## Total household income: <$10,000 = 1,10K-19,999 = 2, 20K-29,999 = 3,30K-39,999 = 4, 40K-49,999 = 5, 50K-74,999 = 6, 75K-99,999 = 7, >=100,000 = 8
## Low income == 1-2
summary(as.factor(d4$SSAGA_Income))
## 1 2 3 4 5 6 7 8 NA's
## 54 48 68 75 70 129 83 96 4
## Years of education completed: <11 = 11; 12; 13; 14; 15; 16; 17+ = 17
summary(as.factor(d4$SSAGA_Educ))
## 11 12 13 14 15 16 17 NA's
## 23 92 37 82 26 255 111 1
## Is respondent still in school for degree course? no = 0; yes = 1
summary(as.factor(d4$SSAGA_InSchool))
## 0 1 NA's
## 519 107 1
## Is respondent married or in live-in relationship? no = 0; yes = 1
summary(as.factor(d4$SSAGA_Rlshp))
## 0 1 NA's
## 315 311 1
If single: THI < 20K If married: THI <30K
low_income_single<-subset(d4 , d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 0 & d4$SSAGA_Income %in% c('1', '2'))
low_income_married<-subset(d4 , d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 1 & d4$SSAGA_Income %in% c('1', '2','3'))
low<-rbind(low_income_married, low_income_single)
d4$SES[d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 0 & d4$SSAGA_Income %in% c('1', '2')]<-"low_single"
d4$SES[d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 1 & d4$SSAGA_Income %in% c('1', '2','3')]<-"low_married"
d4$SES[d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 0 & d4$SSAGA_Income %in% c('3','4','5','6','7','8')]<-"norm_single"
d4$SES[d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 1 & d4$SSAGA_Income %in% c('4','5','6','7','8')]<-"norm_married"
d4$SES[d4$SSAGA_InSchool == 1 & d4$SSAGA_Rlshp == 0 & d4$SSAGA_Income %in% c('1', '2')]<-"low_single_school"
d4$SES[d4$SSAGA_InSchool == 1 & d4$SSAGA_Rlshp == 1 & d4$SSAGA_Income %in% c('1', '2','3')]<-"low_married_school"
d4$SES[d4$SSAGA_InSchool == 1 & d4$SSAGA_Rlshp == 0 & d4$SSAGA_Income %in% c('3','4','5','6','7','8')]<-"norm_single_school"
d4$SES[d4$SSAGA_InSchool == 1 & d4$SSAGA_Rlshp == 1 & d4$SSAGA_Income %in% c('4','5','6','7','8')]<-"norm_married_school"
d4$SES_comp[d4$SES %in% c('low_single', 'low_married','low_single_school','low_married_school')]<-"low"
d4$SES_comp[d4$SES %in% c('norm_single', 'norm_married','norm_single_school','norm_married_school')]<-"norm"
ggplot(subset(d4, d4$SES_comp != is.na(d4$SES_comp)), aes(Menstrual_AgeBegan, BMI, group=SES_comp, color=SES_comp)) +
geom_point(shape=1) +
geom_smooth(method=lm)+theme_classic()+scale_y_continuous(name="Body Mass Index (BMI)")+
scale_x_continuous(name="Age of onset of menstration")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
d4$SES_comp <- factor(d4$SES_comp)
summary(d4$SES_comp)
## low norm NA's
## 114 509 4
mylogit <- glm(SES_comp ~ Menstrual_AgeBegan*BMI, data = subset(d4, d4$SES_comp != is.na(d4$SES_comp)), family = "binomial")
summary(mylogit)
##
## Call:
## glm(formula = SES_comp ~ Menstrual_AgeBegan * BMI, family = "binomial",
## data = subset(d4, d4$SES_comp != is.na(d4$SES_comp)))
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0801 0.5254 0.5655 0.6379 1.2320
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 5.59335 3.79202 1.475 0.140
## Menstrual_AgeBegan -0.22182 0.30049 -0.738 0.460
## BMI -0.19938 0.13238 -1.506 0.132
## Menstrual_AgeBegan:BMI 0.01214 0.01063 1.142 0.253
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 592.96 on 622 degrees of freedom
## Residual deviance: 576.58 on 619 degrees of freedom
## AIC: 584.58
##
## Number of Fisher Scoring iterations: 4
summary(as.factor(d4$SES_comp))
## low norm NA's
## 114 509 4
mytable <- table(as.factor(d4$SES_comp), as.factor(d4$AoM))
chisq.test(mytable)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: mytable
## X-squared = 2.4843, df = 1, p-value = 0.115
No difference in low and high although the cell sizes are uneven
sig 3->6 == V36 check 6 -> 3 == V78 12->13 == V192 check 13->12 == V178
Race Ethnicity Age_in_Yrs
ctrl1<-lm(BMI~Race+Ethnicity+Age_in_Yrs, data=d4)
p.adjust(coef(summary(ctrl1))[, 4], method="BH")
## (Intercept)
## 0.003642269
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.
## 0.767534563
## RaceBlack or African Am.
## 0.953390990
## RaceMore than one
## 0.953390990
## RaceUnknown or Not Reported
## 0.953390990
## RaceWhite
## 0.953390990
## EthnicityNot Hispanic/Latino
## 0.953390990
## EthnicityUnknown or Not Reported
## 0.660749196
## Age_in_Yrs
## 0.059128355
ctrl2<-lm(Menstrual_AgeBegan~Race+Ethnicity+Age_in_Yrs, data=d4)
p.adjust(coef(summary(ctrl2))[, 4], method="BH")
## (Intercept)
## 8.585446e-18
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.
## 6.348709e-02
## RaceBlack or African Am.
## 6.348709e-02
## RaceMore than one
## 6.555952e-02
## RaceUnknown or Not Reported
## 7.861107e-02
## RaceWhite
## 6.555952e-02
## EthnicityNot Hispanic/Latino
## 6.555952e-02
## EthnicityUnknown or Not Reported
## 9.432706e-01
## Age_in_Yrs
## 9.378115e-01
dwplot(list(ctrl1, ctrl2), vline = geom_vline(xintercept = 0, colour = "grey60", linetype = 2))+theme_classic()
Looks like I can drop ethnicity since it is not related to either BMI nor Puberty.
Bonferroni Cor #: 11
ad = 11
mDD1<-lm(DDisc_AUC_200~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mDD1)
##
## Call:
## lm(formula = DDisc_AUC_200 ~ BMI * Menstrual_AgeBegan + Race +
## Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.32896 -0.12054 -0.04925 0.08143 0.72672
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 0.3812167 0.3462274 1.101
## BMI -0.0083589 0.0103620 -0.807
## Menstrual_AgeBegan -0.0225199 0.0222581 -1.012
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.2343286 0.1930114 1.214
## RaceBlack or African Am. 0.0704554 0.1905110 0.370
## RaceMore than one 0.3056651 0.1956135 1.563
## RaceUnknown or Not Reported 0.1027412 0.1967478 0.522
## RaceWhite 0.1861582 0.1896346 0.982
## Age_in_Yrs 0.0003199 0.0021866 0.146
## BMI:Menstrual_AgeBegan 0.0005876 0.0008205 0.716
## Pr(>|t|)
## (Intercept) 0.271
## BMI 0.420
## Menstrual_AgeBegan 0.312
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.225
## RaceBlack or African Am. 0.712
## RaceMore than one 0.119
## RaceUnknown or Not Reported 0.602
## RaceWhite 0.327
## Age_in_Yrs 0.884
## BMI:Menstrual_AgeBegan 0.474
##
## Residual standard error: 0.1882 on 611 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.08085, Adjusted R-squared: 0.06731
## F-statistic: 5.971 on 9 and 611 DF, p-value: 4.929e-08
mDD2<-lm(DDisc_AUC_40K~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mDD2)#trend
##
## Call:
## lm(formula = DDisc_AUC_40K ~ BMI * Menstrual_AgeBegan + Race +
## Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.57535 -0.22002 -0.00414 0.22859 0.61317
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 1.053e+00 5.087e-01 2.071
## BMI -3.203e-02 1.522e-02 -2.104
## Menstrual_AgeBegan -6.539e-02 3.270e-02 -1.999
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 4.980e-01 2.836e-01 1.756
## RaceBlack or African Am. 2.574e-01 2.799e-01 0.920
## RaceMore than one 5.173e-01 2.874e-01 1.800
## RaceUnknown or Not Reported 1.622e-01 2.891e-01 0.561
## RaceWhite 4.264e-01 2.786e-01 1.530
## Age_in_Yrs -4.756e-05 3.213e-03 -0.015
## BMI:Menstrual_AgeBegan 2.179e-03 1.206e-03 1.807
## Pr(>|t|)
## (Intercept) 0.0388 *
## BMI 0.0358 *
## Menstrual_AgeBegan 0.0460 *
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.0796 .
## RaceBlack or African Am. 0.3582
## RaceMore than one 0.0723 .
## RaceUnknown or Not Reported 0.5749
## RaceWhite 0.1264
## Age_in_Yrs 0.9882
## BMI:Menstrual_AgeBegan 0.0712 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2765 on 611 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.1066, Adjusted R-squared: 0.09341
## F-statistic: 8.098 on 9 and 611 DF, p-value: 2.141e-11
p.adjust(coef(summary(mDD2))[, 4], method="BH", ad)
## (Intercept)
## 0.1459248
## BMI
## 0.1459248
## Menstrual_AgeBegan
## 0.1459248
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.
## 0.1459248
## RaceBlack or African Am.
## 0.4924989
## RaceMore than one
## 0.1459248
## RaceUnknown or Not Reported
## 0.7026915
## RaceWhite
## 0.1987010
## Age_in_Yrs
## 1.0000000
## BMI:Menstrual_AgeBegan
## 0.1459248
mSM1<-lm(PicSeq_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mSM1)
##
## Call:
## lm(formula = PicSeq_AgeAdj ~ BMI * Menstrual_AgeBegan + Race +
## Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -44.538 -10.356 0.158 11.099 37.818
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 125.07260 28.37877 4.407
## BMI -0.59511 0.84772 -0.702
## Menstrual_AgeBegan -0.85907 1.82206 -0.471
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 4.22373 15.83474 0.267
## RaceBlack or African Am. -13.67411 15.64343 -0.874
## RaceMore than one -0.27585 16.04439 -0.017
## RaceUnknown or Not Reported 6.90784 16.15559 0.428
## RaceWhite -3.31537 15.57151 -0.213
## Age_in_Yrs 0.12556 0.17840 0.704
## BMI:Menstrual_AgeBegan 0.02776 0.06714 0.413
## Pr(>|t|)
## (Intercept) 1.23e-05 ***
## BMI 0.483
## Menstrual_AgeBegan 0.637
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.790
## RaceBlack or African Am. 0.382
## RaceMore than one 0.986
## RaceUnknown or Not Reported 0.669
## RaceWhite 0.831
## Age_in_Yrs 0.482
## BMI:Menstrual_AgeBegan 0.679
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.45 on 617 degrees of freedom
## Multiple R-squared: 0.1109, Adjusted R-squared: 0.09794
## F-statistic: 8.552 on 9 and 617 DF, p-value: 4.029e-12
mCS1<-lm(CardSort_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mCS1)
##
## Call:
## lm(formula = CardSort_AgeAdj ~ BMI * Menstrual_AgeBegan + Race +
## Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -44.175 -7.013 -0.030 7.189 21.247
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 117.14943 18.31117 6.398
## BMI -0.54465 0.54669 -0.996
## Menstrual_AgeBegan -0.80397 1.17550 -0.684
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. -2.23413 10.20829 -0.219
## RaceBlack or African Am. -4.41744 10.08481 -0.438
## RaceMore than one -3.43008 10.34345 -0.332
## RaceUnknown or Not Reported -3.50313 10.44505 -0.335
## RaceWhite -2.12065 10.03864 -0.211
## Age_in_Yrs 0.09607 0.11539 0.833
## BMI:Menstrual_AgeBegan 0.02573 0.04331 0.594
## Pr(>|t|)
## (Intercept) 3.13e-10 ***
## BMI 0.320
## Menstrual_AgeBegan 0.494
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.827
## RaceBlack or African Am. 0.662
## RaceMore than one 0.740
## RaceUnknown or Not Reported 0.737
## RaceWhite 0.833
## Age_in_Yrs 0.405
## BMI:Menstrual_AgeBegan 0.553
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.962 on 614 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.03404, Adjusted R-squared: 0.01989
## F-statistic: 2.404 on 9 and 614 DF, p-value: 0.01103
mFl1<-lm(Flanker_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mFl1)
##
## Call:
## lm(formula = Flanker_AgeAdj ~ BMI * Menstrual_AgeBegan + Race +
## Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -26.4817 -6.2375 0.0521 7.2653 22.9603
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 127.21293 17.59200 7.231
## BMI -0.41547 0.52550 -0.791
## Menstrual_AgeBegan -0.77901 1.12950 -0.690
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. -10.66154 9.81595 -1.086
## RaceBlack or African Am. -14.85533 9.69736 -1.532
## RaceMore than one -12.14033 9.94592 -1.221
## RaceUnknown or Not Reported -14.75379 10.01485 -1.473
## RaceWhite -11.26930 9.65278 -1.167
## Age_in_Yrs -0.12929 0.11059 -1.169
## BMI:Menstrual_AgeBegan 0.02906 0.04162 0.698
## Pr(>|t|)
## (Intercept) 1.42e-12 ***
## BMI 0.429
## Menstrual_AgeBegan 0.491
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.278
## RaceBlack or African Am. 0.126
## RaceMore than one 0.223
## RaceUnknown or Not Reported 0.141
## RaceWhite 0.243
## Age_in_Yrs 0.243
## BMI:Menstrual_AgeBegan 0.485
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.579 on 617 degrees of freedom
## Multiple R-squared: 0.03201, Adjusted R-squared: 0.01789
## F-statistic: 2.267 on 9 and 617 DF, p-value: 0.01679
mCF1<-lm(CogFluidComp_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mCF1)
##
## Call:
## lm(formula = CogFluidComp_AgeAdj ~ BMI * Menstrual_AgeBegan +
## Race + Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -37.42 -11.99 -0.38 11.09 47.38
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 121.40931 29.80462 4.074
## BMI -0.83577 0.90344 -0.925
## Menstrual_AgeBegan -1.27557 1.92879 -0.661
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 10.34988 16.38254 0.632
## RaceBlack or African Am. -6.54401 16.18393 -0.404
## RaceMore than one 6.49274 16.60086 0.391
## RaceUnknown or Not Reported 6.48839 16.76291 0.387
## RaceWhite 4.71936 16.11001 0.293
## Age_in_Yrs 0.14361 0.18646 0.770
## BMI:Menstrual_AgeBegan 0.04264 0.07144 0.597
## Pr(>|t|)
## (Intercept) 5.25e-05 ***
## BMI 0.355
## Menstrual_AgeBegan 0.509
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.528
## RaceBlack or African Am. 0.686
## RaceMore than one 0.696
## RaceUnknown or Not Reported 0.699
## RaceWhite 0.770
## Age_in_Yrs 0.442
## BMI:Menstrual_AgeBegan 0.551
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.98 on 606 degrees of freedom
## (11 observations deleted due to missingness)
## Multiple R-squared: 0.1073, Adjusted R-squared: 0.09408
## F-statistic: 8.096 on 9 and 606 DF, p-value: 2.182e-11
mCCom1<-lm(CogTotalComp_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mCCom1)
##
## Call:
## lm(formula = CogTotalComp_AgeAdj ~ BMI * Menstrual_AgeBegan +
## Race + Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -48.703 -12.174 -0.557 12.589 58.961
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 170.45210 34.37159 4.959
## BMI -2.08753 1.04188 -2.004
## Menstrual_AgeBegan -4.57943 2.22434 -2.059
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 30.20733 18.89285 1.599
## RaceBlack or African Am. -0.15883 18.66380 -0.009
## RaceMore than one 20.85313 19.14461 1.089
## RaceUnknown or Not Reported 13.58817 19.33150 0.703
## RaceWhite 19.34549 18.57856 1.041
## Age_in_Yrs -0.17706 0.21504 -0.823
## BMI:Menstrual_AgeBegan 0.12567 0.08239 1.525
## Pr(>|t|)
## (Intercept) 9.21e-07 ***
## BMI 0.0456 *
## Menstrual_AgeBegan 0.0399 *
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.1104
## RaceBlack or African Am. 0.9932
## RaceMore than one 0.2765
## RaceUnknown or Not Reported 0.4824
## RaceWhite 0.2982
## Age_in_Yrs 0.4106
## BMI:Menstrual_AgeBegan 0.1277
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 18.43 on 606 degrees of freedom
## (11 observations deleted due to missingness)
## Multiple R-squared: 0.2227, Adjusted R-squared: 0.2112
## F-statistic: 19.29 on 9 and 606 DF, p-value: < 2.2e-16
The Crystallized Cognition Composite score is derived by averaging the normalized scores of each of the Toolbox tests that are crystallized measures (Picture Vocabulary and Reading Tests), then deriving scale scores based on this new distribution. One can interpret the Crystallized Cognition Composite as a more global assessment of individual and group verbal reasoning. Higher scores indicate higher levels of functioning. Age-adjusted Scale Score: Participant score is normed using the age appropriate band of Toolbox Norming Sample (bands of ages 18-29, or 30-35), where a score of 100 indicates performance that was at the national average and a score of 115 or 85, indicates performance 1 SD above or below the national average for participants age band.
mCCr1<-lm(CogCrystalComp_AgeAdj~log10(BMI)*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mCCr1) #SIGNIFICANT
##
## Call:
## lm(formula = CogCrystalComp_AgeAdj ~ log10(BMI) * Menstrual_AgeBegan +
## Race + Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -43.019 -11.159 0.767 11.106 43.461
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 325.1037 81.3223 3.998
## log10(BMI) -149.7892 56.5838 -2.647
## Menstrual_AgeBegan -15.1775 6.2809 -2.416
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 31.4517 15.6442 2.010
## RaceBlack or African Am. 5.7240 15.4479 0.371
## RaceMore than one 22.9211 15.8447 1.447
## RaceUnknown or Not Reported 13.9359 15.9521 0.874
## RaceWhite 22.4371 15.3779 1.459
## Age_in_Yrs -0.1626 0.1770 -0.918
## log10(BMI):Menstrual_AgeBegan 9.5416 4.4400 2.149
## Pr(>|t|)
## (Intercept) 7.18e-05 ***
## log10(BMI) 0.00833 **
## Menstrual_AgeBegan 0.01596 *
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.04482 *
## RaceBlack or African Am. 0.71111
## RaceMore than one 0.14852
## RaceUnknown or Not Reported 0.38267
## RaceWhite 0.14507
## Age_in_Yrs 0.35872
## log10(BMI):Menstrual_AgeBegan 0.03202 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.25 on 611 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.2449, Adjusted R-squared: 0.2338
## F-statistic: 22.02 on 9 and 611 DF, p-value: < 2.2e-16
### it appears that race only improves the model for Asian therefore we will test this without the asian population which is low (36)
p.adjust(coef(summary(mCCr1))[, 4], method="BH", ad)
## (Intercept)
## 0.0007895408
## log10(BMI)
## 0.0457885642
## Menstrual_AgeBegan
## 0.0585375237
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.
## 0.0986118015
## RaceBlack or African Am.
## 0.7822261331
## RaceMore than one
## 0.2333852541
## RaceUnknown or Not Reported
## 0.4677101937
## RaceWhite
## 0.2333852541
## Age_in_Yrs
## 0.4677101937
## log10(BMI):Menstrual_AgeBegan
## 0.0880662676
ggplot(subset(d4, !is.na(AoM)), aes(BMI, CogCrystalComp_AgeAdj, color=AoM, group=AoM)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="crystal cognition")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
## Warning: Removed 3 rows containing non-finite values (stat_smooth).
## Warning: Removed 3 rows containing missing values (geom_point).
The DAG is mostly descriptive as the cross-sectional nature of data doesn’t allow causal modeling
#AoMBMI_dag <- dagify(CogCrystalComp_AgeAdj~V178,
# CogCrystalComp_AgeAdj~BMI+Menstrual_AgeBegan+V178,
# CogCrystalComp_AgeAdj~BMI+Menstrual_AgeBegan,
# CogCrystalComp_AgeAdj~BMI,
# CogCrystalComp_AgeAdj~Menstrual_AgeBegan,
# Menstrual_AgeBegan~Race,
# V178~BMI+Menstrual_AgeBegan,
# BMI~Menstrual_AgeBegan+Age_in_Yrs,
# labels = c("Menstrual_AgeBegan" = "Age at onset of menses",
# "BMI" = "BMI",
# "CogCrystalComp_AgeAdj" = "Cognition Crystallized Composite\n age adjusted",
# "Age_in_Yrs" = "Age",
# "Race" = "Race",
# "V178" = "Functional connectivity\n between IC12 and IC13"),
# latent = "BMI",
# exposure = "Menstrual_AgeBegan",
# outcome = "CogCrystalComp_AgeAdj")
#ggdag(AoMBMI_dag, text = FALSE, use_labels = "label")
mCCr2<-lm(CogCrystalComp_AgeAdj~V178+Race+Age_in_Yrs, data = d4)
summary(mCCr2) #trend
##
## Call:
## lm(formula = CogCrystalComp_AgeAdj ~ V178 + Race + Age_in_Yrs,
## data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -42.354 -10.324 0.529 11.935 36.835
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 94.0564 16.8573 5.580
## V178 -0.2911 0.1545 -1.884
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 37.4421 15.6536 2.392
## RaceBlack or African Am. 9.8203 15.4788 0.634
## RaceMore than one 26.1362 16.0466 1.629
## RaceUnknown or Not Reported 10.1939 16.1526 0.631
## RaceWhite 25.2449 15.4016 1.639
## Age_in_Yrs -0.2925 0.1950 -1.500
## Pr(>|t|)
## (Intercept) 3.96e-08 ***
## V178 0.0602 .
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.0171 *
## RaceBlack or African Am. 0.5261
## RaceMore than one 0.1040
## RaceUnknown or Not Reported 0.5283
## RaceWhite 0.1018
## Age_in_Yrs 0.1343
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.31 on 499 degrees of freedom
## (120 observations deleted due to missingness)
## Multiple R-squared: 0.185, Adjusted R-squared: 0.1736
## F-statistic: 16.19 on 7 and 499 DF, p-value: < 2.2e-16
p.adjust(coef(summary(mCCr2))[, 4], method="BH", ad)
## (Intercept)
## 4.356370e-07
## V178
## 2.205811e-01
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.
## 9.421264e-02
## RaceBlack or African Am.
## 7.263668e-01
## RaceMore than one
## 2.287846e-01
## RaceUnknown or Not Reported
## 7.263668e-01
## RaceWhite
## 2.287846e-01
## Age_in_Yrs
## 2.461833e-01
ggplot(subset(d4, !is.na(AoM)), aes(V178, CogCrystalComp_AgeAdj, color=AoM, group=AoM)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="crystal cognition")+
scale_x_continuous(name="connectivity")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
## Warning: Removed 49 rows containing non-finite values (stat_smooth).
## Warning: Removed 49 rows containing missing values (geom_point).
mCCr2.1<-lm(CogCrystalComp_AgeAdj~log10(BMI)*Menstrual_AgeBegan+V178+Race+Age_in_Yrs, data = d4)
summary(mCCr2.1)
##
## Call:
## lm(formula = CogCrystalComp_AgeAdj ~ log10(BMI) * Menstrual_AgeBegan +
## V178 + Race + Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -42.562 -10.957 0.403 10.967 38.470
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 342.3108 95.3470 3.590
## log10(BMI) -162.4318 66.8886 -2.428
## Menstrual_AgeBegan -16.3684 7.2894 -2.245
## V178 -0.3400 0.1529 -2.224
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 31.1838 15.5416 2.006
## RaceBlack or African Am. 7.1168 15.3340 0.464
## RaceMore than one 22.7642 15.8734 1.434
## RaceUnknown or Not Reported 6.9014 15.9800 0.432
## RaceWhite 21.4788 15.2460 1.409
## Age_in_Yrs -0.2578 0.1928 -1.337
## log10(BMI):Menstrual_AgeBegan 10.7035 5.1826 2.065
## Pr(>|t|)
## (Intercept) 0.000363 ***
## log10(BMI) 0.015520 *
## Menstrual_AgeBegan 0.025176 *
## V178 0.026613 *
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.045348 *
## RaceBlack or African Am. 0.642767
## RaceMore than one 0.152172
## RaceUnknown or Not Reported 0.666017
## RaceWhite 0.159515
## Age_in_Yrs 0.181729
## log10(BMI):Menstrual_AgeBegan 0.039417 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.05 on 496 degrees of freedom
## (120 observations deleted due to missingness)
## Multiple R-squared: 0.2172, Adjusted R-squared: 0.2014
## F-statistic: 13.76 on 10 and 496 DF, p-value: < 2.2e-16
p.adjust(coef(summary(mCCr2.1))[, 4], method="BH", ad)
## (Intercept)
## 0.003996854
## log10(BMI)
## 0.073185842
## Menstrual_AgeBegan
## 0.073185842
## V178
## 0.073185842
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.
## 0.083137242
## RaceBlack or African Am.
## 0.666017291
## RaceMore than one
## 0.219333458
## RaceUnknown or Not Reported
## 0.666017291
## RaceWhite
## 0.219333458
## Age_in_Yrs
## 0.222113668
## log10(BMI):Menstrual_AgeBegan
## 0.083137242
lm.beta(mCCr2.1)
##
## Call:
## lm(formula = CogCrystalComp_AgeAdj ~ log10(BMI) * Menstrual_AgeBegan +
## V178 + Race + Age_in_Yrs, data = d4)
##
## Standardized Coefficients::
## (Intercept)
## 0.00000000
## log10(BMI)
## -0.84310813
## Menstrual_AgeBegan
## -1.53076588
## V178
## -0.08950405
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.
## 0.45726941
## RaceBlack or African Am.
## 0.15183049
## RaceMore than one
## 0.20570414
## RaceUnknown or Not Reported
## 0.05704429
## RaceWhite
## 0.56165441
## Age_in_Yrs
## -0.05534055
## log10(BMI):Menstrual_AgeBegan
## 1.46873070
ggplot(subset(d4, !is.na(AoM)), aes(BMI, V178, color=AoM, group=AoM)) +
geom_point(shape=1) +
geom_smooth(method=lm)+scale_y_continuous(name="connectivity")+
scale_x_continuous(name="BMI")+
theme(axis.title.x = element_text( size=20),axis.text.x = element_text(size=20))+
theme(axis.title.y = element_text( size=20),axis.text.y = element_text(size=20))
## Warning: Removed 47 rows containing non-finite values (stat_smooth).
## Warning: Removed 47 rows containing missing values (geom_point).
Partial mediation
Probably nothing because the correction for multiple comparisons
mCCr4<-lm(CogCrystalComp_AgeAdj~BMI*Menstrual_AgeBegan+V178+Race+Age_in_Yrs, data = d4)
summary(mCCr4)
##
## Call:
## lm(formula = CogCrystalComp_AgeAdj ~ BMI * Menstrual_AgeBegan +
## V178 + Race + Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -42.814 -10.857 0.466 10.946 38.280
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 175.10837 32.33549 5.415
## BMI -2.38736 1.05050 -2.273
## Menstrual_AgeBegan -5.38806 2.15511 -2.500
## V178 -0.33420 0.15312 -2.183
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 31.70272 15.54683 2.039
## RaceBlack or African Am. 7.14835 15.34887 0.466
## RaceMore than one 22.85110 15.88913 1.438
## RaceUnknown or Not Reported 6.84386 15.99822 0.428
## RaceWhite 21.60284 15.25883 1.416
## Age_in_Yrs -0.25326 0.19312 -1.311
## BMI:Menstrual_AgeBegan 0.15826 0.08173 1.936
## Pr(>|t|)
## (Intercept) 9.55e-08 ***
## BMI 0.0235 *
## Menstrual_AgeBegan 0.0127 *
## V178 0.0295 *
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.0420 *
## RaceBlack or African Am. 0.6416
## RaceMore than one 0.1510
## RaceUnknown or Not Reported 0.6690
## RaceWhite 0.1575
## Age_in_Yrs 0.1903
## BMI:Menstrual_AgeBegan 0.0534 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 15.07 on 496 degrees of freedom
## (120 observations deleted due to missingness)
## Multiple R-squared: 0.2146, Adjusted R-squared: 0.1988
## F-statistic: 13.55 on 10 and 496 DF, p-value: < 2.2e-16
plot(mCCr4)
## Warning: not plotting observations with leverage one:
## 19
## Warning: not plotting observations with leverage one:
## 19
mCCr5<-lm(V178~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data=d4)
summary(mCCr5)
##
## Call:
## lm(formula = V178 ~ BMI * Menstrual_AgeBegan + Race + Age_in_Yrs,
## data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -13.3232 -2.6670 -0.0057 3.0862 13.0576
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 29.66542 9.08531 3.265
## BMI -0.71496 0.29051 -2.461
## Menstrual_AgeBegan -1.39031 0.60243 -2.308
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. -6.51400 4.53476 -1.436
## RaceBlack or African Am. -5.94686 4.47840 -1.328
## RaceMore than one -4.67475 4.63905 -1.008
## RaceUnknown or Not Reported -6.87927 4.66544 -1.475
## RaceWhite -6.66235 4.44968 -1.497
## Age_in_Yrs -0.03917 0.05629 -0.696
## BMI:Menstrual_AgeBegan 0.05400 0.02268 2.381
## Pr(>|t|)
## (Intercept) 0.00117 **
## BMI 0.01419 *
## Menstrual_AgeBegan 0.02142 *
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.15150
## RaceBlack or African Am. 0.18482
## RaceMore than one 0.31409
## RaceUnknown or Not Reported 0.14097
## RaceWhite 0.13496
## Age_in_Yrs 0.48680
## BMI:Menstrual_AgeBegan 0.01763 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.406 on 500 degrees of freedom
## (117 observations deleted due to missingness)
## Multiple R-squared: 0.02456, Adjusted R-squared: 0.007006
## F-statistic: 1.399 on 9 and 500 DF, p-value: 0.1855
ind2<--0.38462*0.05209
ind2
## [1] -0.02003486
model 1 CogCrystalComp_AgeAdj~BMI*Menstrual_AgeBegan+V178
model 2 V178~BMI*Menstrual_AgeBegan
rsq <- function(formula1,formula2, data, indices) {
d <- data[indices,] # allows boot to select sample
M1 <- lm(formula1, data=d)
M2 <- lm(formula2, data=d)
B_ind <- coef(M1)[4]*coef(M2)[4]
return(B_ind)
}
# bootstrapping with 100000 replications
#results <- boot(data=d4, statistic=rsq,
# R=100000, formula1=CogCrystalComp_AgeAdj~BMI*Menstrual_AgeBegan+V178+Race+Age_in_Yrs,
# formula2=V178~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs)
# view results
#results
#plot(results)
# get 95% confidence interval
#boot.ci(results, type="bca")
mHb1<-lm(HbA1C~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mHb1)
##
## Call:
## lm(formula = HbA1C ~ BMI * Menstrual_AgeBegan + Race + Age_in_Yrs,
## data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.8424 -0.1793 0.0270 0.1804 0.9594
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 5.395403 0.837084 6.445
## BMI 0.018320 0.027399 0.669
## Menstrual_AgeBegan 0.021627 0.057854 0.374
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. -0.692104 0.376010 -1.841
## RaceBlack or African Am. -0.529109 0.369897 -1.430
## RaceMore than one -0.560163 0.384683 -1.456
## RaceUnknown or Not Reported -0.654444 0.386128 -1.695
## RaceWhite -0.730967 0.366667 -1.994
## Age_in_Yrs 0.007358 0.005277 1.394
## BMI:Menstrual_AgeBegan -0.001357 0.002161 -0.628
## Pr(>|t|)
## (Intercept) 3.48e-10 ***
## BMI 0.5041
## Menstrual_AgeBegan 0.7087
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.0664 .
## RaceBlack or African Am. 0.1534
## RaceMore than one 0.1462
## RaceUnknown or Not Reported 0.0909 .
## RaceWhite 0.0469 *
## Age_in_Yrs 0.1640
## BMI:Menstrual_AgeBegan 0.5306
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3617 on 382 degrees of freedom
## (235 observations deleted due to missingness)
## Multiple R-squared: 0.06407, Adjusted R-squared: 0.04202
## F-statistic: 2.905 on 9 and 382 DF, p-value: 0.002444
mEn1<-lm(Endurance_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mEn1)
##
## Call:
## lm(formula = Endurance_AgeAdj ~ BMI * Menstrual_AgeBegan + Race +
## Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -35.907 -7.214 -0.030 7.670 30.812
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 102.98140 20.29238 5.075
## BMI -0.97963 0.60611 -1.616
## Menstrual_AgeBegan -0.23143 1.30280 -0.178
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 9.74609 11.32179 0.861
## RaceBlack or African Am. 4.29325 11.18500 0.384
## RaceMore than one 7.52938 11.47172 0.656
## RaceUnknown or Not Reported 4.89809 11.55121 0.424
## RaceWhite 9.36099 11.13351 0.841
## Age_in_Yrs 0.58469 0.12763 4.581
## BMI:Menstrual_AgeBegan 0.01166 0.04800 0.243
## Pr(>|t|)
## (Intercept) 5.14e-07 ***
## BMI 0.107
## Menstrual_AgeBegan 0.859
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.390
## RaceBlack or African Am. 0.701
## RaceMore than one 0.512
## RaceUnknown or Not Reported 0.672
## RaceWhite 0.401
## Age_in_Yrs 5.60e-06 ***
## BMI:Menstrual_AgeBegan 0.808
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 11.05 on 616 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.2511, Adjusted R-squared: 0.2402
## F-statistic: 22.95 on 9 and 616 DF, p-value: < 2.2e-16
mSt1<-lm(Strength_AgeAdj ~ BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mSt1)
##
## Call:
## lm(formula = Strength_AgeAdj ~ BMI * Menstrual_AgeBegan + Race +
## Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -42.205 -8.108 -0.719 6.195 32.969
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 55.55173 21.72335 2.557
## BMI 0.96911 0.64891 1.493
## Menstrual_AgeBegan 1.75060 1.39475 1.255
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. -13.72485 12.12116 -1.132
## RaceBlack or African Am. -7.67787 11.97472 -0.641
## RaceMore than one -13.19438 12.28165 -1.074
## RaceUnknown or Not Reported -13.80430 12.36677 -1.116
## RaceWhite -11.77779 11.91966 -0.988
## Age_in_Yrs 0.50355 0.13656 3.687
## BMI:Menstrual_AgeBegan -0.05162 0.05139 -1.005
## Pr(>|t|)
## (Intercept) 0.010789 *
## BMI 0.135832
## Menstrual_AgeBegan 0.209905
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.257946
## RaceBlack or African Am. 0.521648
## RaceMore than one 0.283101
## RaceUnknown or Not Reported 0.264753
## RaceWhite 0.323492
## Age_in_Yrs 0.000247 ***
## BMI:Menstrual_AgeBegan 0.315528
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 11.83 on 617 degrees of freedom
## Multiple R-squared: 0.09271, Adjusted R-squared: 0.07947
## F-statistic: 7.005 on 9 and 617 DF, p-value: 1.14e-09
mStress1<-lm(PercStress_Unadj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mStress1)
##
## Call:
## lm(formula = PercStress_Unadj ~ BMI * Menstrual_AgeBegan + Race +
## Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -29.2803 -5.7331 -0.3108 5.2402 30.4297
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 71.30991 16.29847 4.375
## BMI -0.07563 0.48681 -0.155
## Menstrual_AgeBegan -0.58008 1.04626 -0.554
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. -10.84342 9.09255 -1.193
## RaceBlack or African Am. -8.24898 8.98285 -0.918
## RaceMore than one -10.93421 9.21288 -1.187
## RaceUnknown or Not Reported -10.97058 9.27671 -1.183
## RaceWhite -10.86602 8.94132 -1.215
## Age_in_Yrs -0.22718 0.10257 -2.215
## BMI:Menstrual_AgeBegan 0.01205 0.03855 0.312
## Pr(>|t|)
## (Intercept) 1.42e-05 ***
## BMI 0.8766
## Menstrual_AgeBegan 0.5795
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.2335
## RaceBlack or African Am. 0.3588
## RaceMore than one 0.2357
## RaceUnknown or Not Reported 0.2374
## RaceWhite 0.2247
## Age_in_Yrs 0.0271 *
## BMI:Menstrual_AgeBegan 0.7548
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.873 on 616 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.0307, Adjusted R-squared: 0.01654
## F-statistic: 2.168 on 9 and 616 DF, p-value: 0.02262
mTCog1<-lm(CogTotalComp_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mTCog1)
##
## Call:
## lm(formula = CogTotalComp_AgeAdj ~ BMI * Menstrual_AgeBegan +
## Race + Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -48.703 -12.174 -0.557 12.589 58.961
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 170.45210 34.37159 4.959
## BMI -2.08753 1.04188 -2.004
## Menstrual_AgeBegan -4.57943 2.22434 -2.059
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 30.20733 18.89285 1.599
## RaceBlack or African Am. -0.15883 18.66380 -0.009
## RaceMore than one 20.85313 19.14461 1.089
## RaceUnknown or Not Reported 13.58817 19.33150 0.703
## RaceWhite 19.34549 18.57856 1.041
## Age_in_Yrs -0.17706 0.21504 -0.823
## BMI:Menstrual_AgeBegan 0.12567 0.08239 1.525
## Pr(>|t|)
## (Intercept) 9.21e-07 ***
## BMI 0.0456 *
## Menstrual_AgeBegan 0.0399 *
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.1104
## RaceBlack or African Am. 0.9932
## RaceMore than one 0.2765
## RaceUnknown or Not Reported 0.4824
## RaceWhite 0.2982
## Age_in_Yrs 0.4106
## BMI:Menstrual_AgeBegan 0.1277
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 18.43 on 606 degrees of freedom
## (11 observations deleted due to missingness)
## Multiple R-squared: 0.2227, Adjusted R-squared: 0.2112
## F-statistic: 19.29 on 9 and 606 DF, p-value: < 2.2e-16
mTaste1<-lm(Taste_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mTaste1)
##
## Call:
## lm(formula = Taste_AgeAdj ~ BMI * Menstrual_AgeBegan + Race +
## Age_in_Yrs, data = d4)
##
## Residuals:
## Min 1Q Median 3Q Max
## -40.215 -10.461 0.498 8.683 34.207
##
## Coefficients:
## Estimate Std. Error t value
## (Intercept) 43.14489 26.57864 1.623
## BMI 1.15638 0.79384 1.457
## Menstrual_AgeBegan 2.35319 1.70654 1.379
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 20.31700 14.82818 1.370
## RaceBlack or African Am. 19.05779 14.64490 1.301
## RaceMore than one 18.33642 15.01961 1.221
## RaceUnknown or Not Reported 28.02868 15.22412 1.841
## RaceWhite 15.82147 14.57698 1.085
## Age_in_Yrs 0.03839 0.16758 0.229
## BMI:Menstrual_AgeBegan -0.07668 0.06288 -1.219
## Pr(>|t|)
## (Intercept) 0.1050
## BMI 0.1457
## Menstrual_AgeBegan 0.1684
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.1711
## RaceBlack or African Am. 0.1936
## RaceMore than one 0.2226
## RaceUnknown or Not Reported 0.0661 .
## RaceWhite 0.2782
## Age_in_Yrs 0.8189
## BMI:Menstrual_AgeBegan 0.2232
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.47 on 611 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.03416, Adjusted R-squared: 0.01993
## F-statistic: 2.401 on 9 and 611 DF, p-value: 0.01116
Self-reported zygosity. Until the S1200 release this was the " measure. The small number of subjects who do not have a value for this measure (blank) self reported as twins but did not self report their twin zygosity."
Twin zygosity verified by genotyping. Requires both subjects in a twin pair to have HasGT=TRUE to have a value (if genotyping is not available for either of a twin pair, no values are given for ZygosityGT). Non-twin subjects also do not have a value for ZygosityGT. Note that some subjects self-reported as dizygotic twins (ZygositySR=‘NotMZ’) but genotyping established that they were monozygotic twins (thence ZygosityGT=‘MZ’ for those subjects). ZygosityGT should be given precedence over ZygositySR.
sig 3->6 == V36 check 6 -> 3 == V78 12->13 == V192 check 13->12 == V178
twins<-subset(d4 , d4$ZygosityGT %in% c('DZ', 'MZ'))
myvars<-c("Family_ID","Subject","Menstrual_AgeBegan","BMI","ZygosityGT","Age_in_Yrs","Race","Gender","V36","V78","V178","V192")
d5<-twins[myvars]
d5$ZygosityGT<-factor(d5$ZygosityGT)
d5$Race<-factor(d5$Race)
d6 <- fast.reshape(d5, id="Family_ID",varying=c("BMI","Menstrual_AgeBegan","Subject","V36","V78","V178","V192"))
d6<-na.omit(d6)
head(d6)
## Family_ID Subject1 Menstrual_AgeBegan1 BMI1 ZygosityGT Age_in_Yrs
## 223 51279_81145 139637 12 24.95 MZ 35
## 857 51293_81159 552544 11 28.66 DZ 35
## 488 51295_81161 191437 11 44.70 DZ 35
## 150 51300_81166 127832 15 20.72 DZ 35
## 319 51303_81168 157336 13 22.27 DZ 34
## 141 51304_81169 125525 14 21.46 MZ 34
## Race Gender V361 V781 V1781 V1921 BMI2
## 223 White F -2.00540 -2.00540 16.3360 16.3360 28.20
## 857 White F 0.63242 0.63242 5.3064 5.3064 19.37
## 488 White F -2.49730 -2.49730 -4.3874 -4.3874 34.50
## 150 White F -5.63610 -5.63610 8.9695 8.9695 23.69
## 319 White F -2.40650 -2.40650 4.7688 4.7688 20.99
## 141 White F 5.30000 5.30000 5.9922 5.9922 20.01
## Menstrual_AgeBegan2 Subject2 V362 V782 V1782 V1922
## 223 15 677968 -3.64770 -3.64770 10.15000 10.15000
## 857 12 887373 0.73871 0.73871 11.19500 11.19500
## 488 13 559053 -0.60196 -0.60196 -2.67200 -2.67200
## 150 12 137431 -4.62170 -4.62170 0.68453 0.68453
## 319 13 429040 -0.50878 -0.50878 6.30830 6.30830
## 141 14 192439 -0.81324 -0.81324 2.76340 2.76340
library("cowplot")
##
## ********************************************************
## Note: As of version 1.0.0, cowplot does not change the
## default ggplot2 theme anymore. To recover the previous
## behavior, execute:
## theme_set(theme_cowplot())
## ********************************************************
##
## Attaching package: 'cowplot'
## The following object is masked from 'package:mosaic':
##
## theme_map
## The following object is masked from 'package:ggpubr':
##
## get_legend
scatterdens <- function(x) {
sp <- ggplot(x,aes_string(colnames(x)[1], colnames(x)[2])) + theme_minimal() + geom_point(alpha=0.3) + geom_density_2d()
xdens <- ggplot(x, aes_string(colnames(x)[1],fill=1)) + theme_minimal() + geom_density(alpha=.5)+ theme(axis.text.x = element_blank(), legend.position = "none" ) + labs(x=NULL)
ydens <- ggplot(x, aes_string(colnames(x)[2],fill=1)) + theme_minimal() + geom_density(alpha=.5) + theme(axis.text.y = element_blank(), axis.text.x = element_text(angle=90, vjust=0), legend.position = "none" ) + labs(x=NULL) + coord_flip()
g <- plot_grid(xdens,NULL,sp,ydens, ncol=2,nrow=2, rel_widths=c(4,1.4),rel_heights=c(1.4,4))
return(g)
}
mz_bmi <- log(subset(d6, ZygosityGT == "MZ" )[,c("BMI1","BMI2")])
p_bmi_mz<-scatterdens(mz_bmi)
mz_aom<-subset(d6, ZygosityGT == "MZ" )[,c("Menstrual_AgeBegan1","Menstrual_AgeBegan2")]
p_aom_mz<-scatterdens(mz_aom)
mz_V178<-subset(d6, ZygosityGT == "MZ" )[,c("V361","V362")]
p_V178_mz<-scatterdens(mz_V178)
mz_V36<-subset(d6, ZygosityGT == "MZ" )[,c("V361","V362")]
p_V36_mz<-scatterdens(mz_V178)
dz_bmi <- log(subset(d6, ZygosityGT == "DZ" )[,c( "BMI1" , "BMI2" )])
p_bmi_dz<-scatterdens(dz_bmi)
dz_aom<-subset(d6, ZygosityGT == "DZ" )[,c("Menstrual_AgeBegan1","Menstrual_AgeBegan2")]
p_aom_dz<-scatterdens(dz_aom)
dz_V178<-subset(d6, ZygosityGT == "DZ" )[,c("V1781","V1782")]
p_V178_dz<-scatterdens(dz_V178)
dz_V36<-subset(d6, ZygosityGT == "DZ" )[,c("V361","V362")]
p_V36_dz<-scatterdens(dz_V178)
ggarrange(p_bmi_mz,p_aom_mz,p_bmi_dz,p_aom_dz + rremove("x.text"),
labels = c("A", "B", "C","D"),
ncol = 2, nrow = 2)
ggarrange(p_V178_mz,p_V178_dz + rremove("x.text"),
labels = c("A", "B"),
ncol = 2, nrow = 1)
ggarrange(p_V36_mz,p_V36_dz + rremove("x.text"),
labels = c("A", "B"),
ncol = 2, nrow = 1)
cor.test(mz_bmi[,1],mz_bmi[,2], method= "spearman" )
## Warning in cor.test.default(x, y, ...): Cannot compute exact p-value with
## ties
##
## Spearman's rank correlation rho
##
## data: x and y
## S = 17655, p-value = 2.06e-07
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.5958124
cor.test(dz_bmi[,1],dz_bmi[,2], method= "spearman" )
## Warning in cor.test.default(x, y, ...): Cannot compute exact p-value with
## ties
##
## Spearman's rank correlation rho
##
## data: x and y
## S = 3832.8, p-value = 0.2189
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.2272636
cor.test(mz_aom[,1],mz_aom[,2], method= "spearman" )
## Warning in cor.test.default(x, y, ...): Cannot compute exact p-value with
## ties
##
## Spearman's rank correlation rho
##
## data: x and y
## S = 26715, p-value = 0.001517
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.38839
cor.test(dz_aom[,1],dz_aom[,2], method= "spearman" )
## Warning in cor.test.default(x, y, ...): Cannot compute exact p-value with
## ties
##
## Spearman's rank correlation rho
##
## data: x and y
## S = 2547.6, p-value = 0.005531
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.4863782
head(d5)
## Family_ID Subject Menstrual_AgeBegan BMI ZygosityGT
## 3 51488_81352 100307 12 22.96 MZ
## 8 51330_81195 101208 15 23.56 DZ
## 15 51679_81543 102311 13 26.77 MZ
## 19 51418_81283 102816 12 27.99 MZ
## 24 51537_52707_81401 103515 12 35.08 DZ
## 25 51343_81208 103818 11 25.34 MZ
## Age_in_Yrs Race Gender V36 V78 V178
## 3 27 White F 6.0281 6.0281 0.44969
## 8 35 Black or African Am. F NA NA NA
## 15 26 White F -4.0466 -4.0466 12.76000
## 19 30 Black or African Am. F 1.0823 1.0823 7.38880
## 24 28 Black or African Am. F -2.8884 -2.8884 2.28300
## 25 32 White F -4.4353 -4.4353 7.54760
## V192
## 3 0.44969
## 8 NA
## 15 12.76000
## 19 7.38880
## 24 2.28300
## 25 7.54760
g1 <- lm(BMI ~ Age_in_Yrs + Race, data=d5)
estimate(g1, id=d5$Family_ID)
## Estimate Std.Err 2.5% 97.5% P-value
## (Intercept) 12.7845 5.681 1.65038 23.9185 2.442e-02
## Age_in_Yrs 0.2852 0.160 -0.02837 0.5988 7.465e-02
## RaceBlack or African Am. 9.1328 3.000 3.25331 15.0124 2.331e-03
## RaceMore than one 11.3661 2.755 5.96663 16.7657 3.695e-05
## RaceUnknown or Not Re.... 5.4727 2.761 0.06176 10.8836 4.744e-02
## RaceWhite 4.6693 2.795 -0.80817 10.1468 9.476e-02
Heritability is formally defined as the proportion of phenotypic variation (VP) that is due to variation in genetic values (VG).
### Broad-sense heritability
Defined as H2 = VG/VP, captures the proportion of phenotypic variation due to genetic values that may include effects due to dominance and epistasis. * dominance - possible allelic interactions within loci
* epistasis- between loci
h2 = VA/VP, refers to the proportion of phenotypic variation that is due to additive genetic values (VA)
The phenotypic variance (VP) in a population is influenced by genetic variance (VG) and environmental sources (VE)
VP = VG + VE so then narrow sense is also defined as:
h2 = EA/(VG+VE)
The total amount of genetic variance can be divided into several groups, including additive variance (VA), dominance variance (VD), and epistatic variance (VI). VG = VA + VD + VI so then narrow sense is also:
h2 = VA/(VA+VD+VI+VE)
dd<-na.omit(d5)
head(dd)
## Family_ID Subject Menstrual_AgeBegan BMI ZygosityGT
## 3 51488_81352 100307 12 22.96 MZ
## 15 51679_81543 102311 13 26.77 MZ
## 19 51418_81283 102816 12 27.99 MZ
## 24 51537_52707_81401 103515 12 35.08 DZ
## 25 51343_81208 103818 11 25.34 MZ
## 26 51678_81542 104012 15 24.17 MZ
## Age_in_Yrs Race Gender V36 V78 V178
## 3 27 White F 6.0281 6.0281 0.44969
## 15 26 White F -4.0466 -4.0466 12.76000
## 19 30 Black or African Am. F 1.0823 1.0823 7.38880
## 24 28 Black or African Am. F -2.8884 -2.8884 2.28300
## 25 32 White F -4.4353 -4.4353 7.54760
## 26 26 White F -1.5093 -1.5093 5.51320
## V192
## 3 0.44969
## 15 12.76000
## 19 7.38880
## 24 2.28300
## 25 7.54760
## 26 5.51320
dd$ZygosityGT <- factor(dd$ZygosityGT)
dd$Race<- factor(dd$Race)
l0 <- twinlm(BMI ~ 1+Age_in_Yrs+Race, data=dd, DZ= "DZ" , zyg= "ZygosityGT" , id="Family_ID", type="aced", missing = T)
summary(l0)
## Estimate Std. Error Z value Pr(>|z|)
## BMI 14.93507 5.29758 2.8192 0.0048140
## sd(A) 2.41081 68.97050 0.0350 0.9721163
## sd(C) 1.44439 38.41215 0.0376 0.9700047
## sd(D) 3.38546 32.75629 0.1034 0.9176827
## sd(E) 2.87752 0.26909 10.6934 < 2.2e-16
## BMI~Age_in_Yrs 0.21305 0.14965 1.4237 0.1545308
## BMI~RaceBlack or African Am. 9.82475 2.69459 3.6461 0.0002663
## BMI~RaceMore than one 5.19727 5.76884 0.9009 0.3676305
## BMI~RaceUnknown or Not Reported 3.89933 3.53399 1.1034 0.2698618
## BMI~RaceWhite 4.07953 2.42347 1.6833 0.0923093
##
## MZ-pairs/singletons DZ-pairs/singletons
## 64/16 31/21
##
## Variance decomposition:
## Estimate 2.5% 97.5%
## A 0.21028 -23.37108 23.79164
## C 0.07548 -7.79302 7.94398
## D 0.41467 -15.31245 16.14179
## E 0.29957 0.17559 0.42355
##
##
## Estimate 2.5% 97.5%
## Broad-sense heritability 0.62495 -7.24496 8.49485
##
## Estimate 2.5% 97.5%
## Correlation within MZ: 0.70043 0.55443 0.80460
## Correlation within DZ: 0.28429 -0.01856 0.53935
##
## 'log Lik.' -675.9436 (df=10)
## AIC: 1371.887
## BIC: 1400.715
l1 <- twinlm(Menstrual_AgeBegan ~ 1+Age_in_Yrs+Race, data=dd, DZ= "DZ" , zyg= "ZygosityGT" , id="Family_ID", type="aced", missing = T)
summary(l1)
## Estimate Std. Error
## Menstrual_AgeBegan 14.352100 1.439256
## sd(A) 0.648681 10.791590
## sd(C) 0.512288 4.576208
## sd(D) 0.629451 7.420457
## sd(E) 1.040114 0.093836
## Menstrual_AgeBegan~Age_in_Yrs -0.052359 0.040571
## Menstrual_AgeBegan~RaceBlack or African Am. -1.117324 0.733629
## Menstrual_AgeBegan~RaceMore than one -0.676625 1.605136
## Menstrual_AgeBegan~RaceUnknown or Not Reported -0.940965 1.004388
## Menstrual_AgeBegan~RaceWhite 0.106366 0.657830
## Z value Pr(>|z|)
## Menstrual_AgeBegan 9.9719 <2e-16
## sd(A) 0.0601 0.9521
## sd(C) 0.1119 0.9109
## sd(D) 0.0848 0.9324
## sd(E) 11.0844 <2e-16
## Menstrual_AgeBegan~Age_in_Yrs -1.2905 0.1969
## Menstrual_AgeBegan~RaceBlack or African Am. -1.5230 0.1278
## Menstrual_AgeBegan~RaceMore than one -0.4215 0.6734
## Menstrual_AgeBegan~RaceUnknown or Not Reported -0.9369 0.3488
## Menstrual_AgeBegan~RaceWhite 0.1617 0.8715
##
## MZ-pairs/singletons DZ-pairs/singletons
## 64/16 31/21
##
## Variance decomposition:
## Estimate 2.5% 97.5%
## A 0.19469 -12.50168 12.89107
## C 0.12143 -4.13037 4.37323
## D 0.18332 -8.28803 8.65467
## E 0.50056 0.31436 0.68676
##
##
## Estimate 2.5% 97.5%
## Broad-sense heritability 0.37802 -3.88132 4.63735
##
## Estimate 2.5% 97.5%
## Correlation within MZ: 0.49944 0.29175 0.66216
## Correlation within DZ: 0.26461 -0.03173 0.51818
##
## 'log Lik.' -399.2659 (df=10)
## AIC: 818.5318
## BIC: 847.3598
l2 <- twinlm(V178 ~ 1+BMI*Menstrual_AgeBegan+Age_in_Yrs+Race, data=d5,
DZ= "DZ" , zyg= "ZygosityGT" , id="Family_ID", type="aced", missing = T)
summary(l2)
## Estimate Std. Error Z value Pr(>|z|)
## V178 1.7567e+01 1.2415e+01 1.4149 0.15708
## sd(A) -1.8552e-04 5.2089e+00 0.0000 0.99997
## sd(C) -6.8486e-05 3.0065e+00 0.0000 0.99998
## sd(D) 3.3043e+00 3.1773e-01 10.3996 < 2e-16
## sd(E) 2.7787e+00 2.3869e-01 11.6419 < 2e-16
## V178~BMI -6.7692e-01 4.1288e-01 -1.6395 0.10111
## V178~Menstrual_AgeBegan -1.0173e+00 8.7185e-01 -1.1668 0.24328
## V178~Age_in_Yrs 2.5778e-03 1.2009e-01 0.0215 0.98287
## V178~RaceBlack or African Am. 2.1774e+00 2.2137e+00 0.9836 0.32532
## V178~RaceMore than one 9.7416e+00 4.7466e+00 2.0523 0.04014
## V178~RaceUnknown or Not Reported 6.5951e-01 2.9447e+00 0.2240 0.82279
## V178~RaceWhite -1.3513e-01 1.9611e+00 -0.0689 0.94506
## V178~BMI:Menstrual_AgeBegan 4.8880e-02 3.2907e-02 1.4854 0.13744
##
## MZ-pairs/singletons DZ-pairs/singletons
## 64/16 31/21
##
## Variance decomposition:
## Estimate 2.5% 97.5%
## A 0.00000 -0.00020 0.00020
## C 0.00000 -0.00004 0.00004
## D 0.58575 0.43764 0.73386
## E 0.41425 0.26614 0.56236
##
##
## Estimate 2.5% 97.5%
## Broad-sense heritability 0.58575 0.43764 0.73386
##
## Estimate 2.5% 97.5%
## Correlation within MZ: 0.58575 0.41837 0.71466
## Correlation within DZ: 0.14644 0.10922 0.18324
##
## 'log Lik.' -640.3355 (df=13)
## AIC: 1306.671
## BIC: 1344.147
l3 <- twinlm(V36 ~ 1+BMI*Menstrual_AgeBegan+Age_in_Yrs+Race, data=d5,
DZ= "DZ" , zyg= "ZygosityGT" , id="Family_ID", type="aced", missing = T)
summary(l3)
## Estimate Std. Error Z value Pr(>|z|)
## V36 25.443084 9.534941 2.6684 0.007621
## sd(A) 1.860063 10.370503 0.1794 0.857654
## sd(C) -0.258759 24.474661 -0.0106 0.991565
## sd(D) 1.599338 8.250464 0.1938 0.846295
## sd(E) 2.160268 0.195572 11.0459 < 2.2e-16
## V36~BMI -0.818838 0.316056 -2.5908 0.009575
## V36~Menstrual_AgeBegan -2.044336 0.668409 -3.0585 0.002224
## V36~Age_in_Yrs 0.054227 0.091909 0.5900 0.555188
## V36~RaceBlack or African Am. -2.724196 1.711788 -1.5914 0.111512
## V36~RaceMore than one -6.788916 3.622731 -1.8740 0.060934
## V36~RaceUnknown or Not Reported 1.556228 2.260495 0.6884 0.491172
## V36~RaceWhite -2.041398 1.506658 -1.3549 0.175444
## V36~BMI:Menstrual_AgeBegan 0.065589 0.025175 2.6053 0.009179
##
## MZ-pairs/singletons DZ-pairs/singletons
## 64/16 31/21
##
## Variance decomposition:
## Estimate 2.5% 97.5%
## A 0.32180 -6.70987 7.35347
## C 0.00623 -2.30276 2.31521
## D 0.23791 -4.57345 5.04927
## E 0.43406 0.26848 0.59963
##
##
## Estimate 2.5% 97.5%
## Broad-sense heritability 0.55971 -1.75534 2.87476
##
## Estimate 2.5% 97.5%
## Correlation within MZ: 0.56594 0.37818 0.70898
## Correlation within DZ: 0.22661 -0.17505 0.56359
##
## 'log Lik.' -578.4937 (df=13)
## AIC: 1182.987
## BIC: 1220.464
knitr::kable(stargazer(mtcars))
##
## % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
## % Date and time: Wed, Aug 14, 2019 - 17:43:34
## \begin{table}[!htbp] \centering
## \caption{}
## \label{}
## \begin{tabular}{@{\extracolsep{5pt}}lccccccc}
## \\[-1.8ex]\hline
## \hline \\[-1.8ex]
## Statistic & \multicolumn{1}{c}{N} & \multicolumn{1}{c}{Mean} & \multicolumn{1}{c}{St. Dev.} & \multicolumn{1}{c}{Min} & \multicolumn{1}{c}{Pctl(25)} & \multicolumn{1}{c}{Pctl(75)} & \multicolumn{1}{c}{Max} \\
## \hline \\[-1.8ex]
## mpg & 32 & 20.091 & 6.027 & 10 & 15.4 & 22.8 & 34 \\
## cyl & 32 & 6.188 & 1.786 & 4 & 4 & 8 & 8 \\
## disp & 32 & 230.722 & 123.939 & 71 & 120.8 & 326 & 472 \\
## hp & 32 & 146.688 & 68.563 & 52 & 96.5 & 180 & 335 \\
## drat & 32 & 3.597 & 0.535 & 2.760 & 3.080 & 3.920 & 4.930 \\
## wt & 32 & 3.217 & 0.978 & 1.513 & 2.581 & 3.610 & 5.424 \\
## qsec & 32 & 17.849 & 1.787 & 14.500 & 16.892 & 18.900 & 22.900 \\
## vs & 32 & 0.438 & 0.504 & 0 & 0 & 1 & 1 \\
## am & 32 & 0.406 & 0.499 & 0 & 0 & 1 & 1 \\
## gear & 32 & 3.688 & 0.738 & 3 & 3 & 4 & 5 \\
## carb & 32 & 2.812 & 1.615 & 1 & 2 & 4 & 8 \\
## \hline \\[-1.8ex]
## \end{tabular}
## \end{table}
| x |
|---|
| % Table created by stargazer v.5.2.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu |
| % Date and time: Wed, Aug 14, 2019 - 17:43:34 |
names(summary(l0))
## [1] "estimate" "zyg" "varEst" "KinshipGroup"
## [5] "varSigma" "heritability" "corMZ" "corDZ"
## [9] "acde" "logLik" "AIC" "BIC"
## [13] "type" "coef" "all" "vcov"
summary(l0)[1]
## $estimate
## Estimate Std. Error Z value
## BMI 14.9350708 5.2975848 2.81922261
## sd(A) 2.4108094 68.9704971 0.03495421
## sd(C) 1.4443865 38.4121466 0.03760234
## sd(D) 3.3854639 32.7562939 0.10335308
## sd(E) 2.8775200 0.2690921 10.69343737
## BMI~Age_in_Yrs 0.2130519 0.1496457 1.42370872
## BMI~RaceBlack or African Am. 9.8247528 2.6945937 3.64609806
## BMI~RaceMore than one 5.1972688 5.7688421 0.90092061
## BMI~RaceUnknown or Not Reported 3.8993321 3.5339855 1.10338091
## BMI~RaceWhite 4.0795292 2.4234730 1.68334007
## Pr(>|z|)
## BMI 4.814012e-03
## sd(A) 9.721163e-01
## sd(C) 9.700047e-01
## sd(D) 9.176827e-01
## sd(E) 1.092455e-26
## BMI~Age_in_Yrs 1.545308e-01
## BMI~RaceBlack or African Am. 2.662524e-04
## BMI~RaceMore than one 3.676305e-01
## BMI~RaceUnknown or Not Reported 2.698618e-01
## BMI~RaceWhite 9.230928e-02
stargazer(summary(l0)[1], summary(l1)[1], title="Results", align=TRUE, type = "text",
style = "ajs", # "ajs"
notes="this is a test note")
##
## Results
## ==========================================================
## Estimate Std. Error Z value Pr(> | z| )
## ----------------------------------------------------------
## BMI 14.935 5.298 2.819 .005
## sd(A) 2.411 68.970 .035 .972
## sd(C) 1.444 38.412 .038 .970
## sd(D) 3.385 32.756 .103 .918
## sd(E) 2.878 .269 10.693 0
## BMI .213 .150 1.424 .155
## BMIor African Am. 9.825 2.695 3.646 0.000
## BMIthan one 5.197 5.769 .901 .368
## BMIor Not Reported 3.899 3.534 1.103 .270
## BMI 4.080 2.423 1.683 .092
## ----------------------------------------------------------
## this is a test note
##
## Results
## =========================================================================
## Estimate Std. Error Z value Pr(> | z| )
## -------------------------------------------------------------------------
## Menstrual_AgeBegan 14.352 1.439 9.972 0
## sd(A) .649 10.792 .060 .952
## sd(C) .512 4.576 .112 .911
## sd(D) .629 7.420 .085 .932
## sd(E) 1.040 .094 11.084 0
## Menstrual_AgeBegan -.052 .041 -1.291 .197
## Menstrual_AgeBeganor African Am. -1.117 .734 -1.523 .128
## Menstrual_AgeBeganthan one -.677 1.605 -.422 .673
## Menstrual_AgeBeganor Not Reported -.941 1.004 -.937 .349
## Menstrual_AgeBegan .106 .658 .162 .872
## -------------------------------------------------------------------------
## this is a test note
x0<-summary(l0)
x1<-summary(l1)
x2<-summary(l2)
x3<-summary(l3)
y0<-as.data.frame(x0[9])
y1<-as.data.frame(x1[9])
y2<-as.data.frame(x2[9])
y3<-as.data.frame(x3[9])
y0$fac<-row.names(y0)
y1$fac<-row.names(y1)
y2$fac<-row.names(y2)
y3$fac<-row.names(y3)
pd <- position_dodge(0.1)
n0= 1
plt0<-ggplot(y0, aes(x=fac, y=acde.Estimate, color=fac)) + ggtitle("BMI") + geom_point(position=position_dodge(), stat="identity",size=n0) +
geom_errorbar(aes(ymin=acde.2.5., ymax=acde.97.5.),
size=.3,
width=.2,
position=position_dodge(.9))+ theme_bw()
plt1<-ggplot(y1, aes(x=fac, y=acde.Estimate, color=fac)) + ggtitle("AoM") + geom_point(position=position_dodge(), stat="identity",size=n0) +
geom_errorbar(aes(ymin=acde.2.5., ymax=acde.97.5.),
size=.3,
width=.2,
position=position_dodge(.9))+ theme_bw()
plt2<-ggplot(y2, aes(x=fac, y=acde.Estimate, color=fac)) + ggtitle("V178") + geom_point(position=position_dodge(), stat="identity",size=n0) +
geom_errorbar(aes(ymin=acde.2.5., ymax=acde.97.5.),
size=.3,
width=.2,
position=position_dodge(.9))+ theme_bw()
plt3<-ggplot(y3, aes(x=fac, y=acde.Estimate, color=fac)) + ggtitle("V36") +geom_point(position=position_dodge(), stat="identity",size=n0) +
geom_errorbar(aes(ymin=acde.2.5., ymax=acde.97.5.),
size=.3,
width=.2,
position=position_dodge(.9))+ theme_bw()
ggarrange(plt0,plt1,plt2,plt3 + rremove("x.text"),
labels = c("A", "B","C","D"),
ncol = 2, nrow = 2)
## Warning: Width not defined. Set with `position_dodge(width = ?)`
## Warning: Width not defined. Set with `position_dodge(width = ?)`
## Warning: Width not defined. Set with `position_dodge(width = ?)`
## Warning: Width not defined. Set with `position_dodge(width = ?)`
## Summary
It appears that the genetic contribution in this sample to BMI and Age of onset of menses is minimal and predomiently through the enviroment. However, we see a large effect of both genetic domience and enviroment on connectivity between 12 and 13. Much more modest differences in the 3 and 6 connectivity with the enviroment.